const { task } = require("hardhat/config");
const { getContract } = require("./helpers");

task("mint", "Mints from the NFT contract")
.addParam("address", "The address to receive a token")
.setAction(async function (taskArguments, hre) {
    const contract = await getContract("ComeSocialNFT", hre);
    let maxFeePerGas = ethers.BigNumber.from(40000000000) // fallback to 40 gwei
    let maxPriorityFeePerGas = ethers.BigNumber.from(40000000000) // fallback to 40 gwei
    const transactionResponse = await contract.mintTo(taskArguments.address, {
        gasLimit: 500_000,
        maxFeePerGas,
        maxPriorityFeePerGas,
    });
    console.log(`Transaction Hash: ${transactionResponse.hash}`);
});


task("totalSupply", "totalSupply")
.setAction(async function (taskArguments, hre) {
    const contract = await getContract("ComeSocialNFT", hre);
    const transactionResponse = await contract.totalSupply();
    console.log(transactionResponse.toNumber());
});

task("setBaseTokenURI", "setBaseTokenURI")
.addParam("basetoken", "baseTokenURI")
.setAction(async function (taskArguments, hre) {
    const contract = await getContract("ComeSocialNFT", hre);
    let maxFeePerGas = ethers.BigNumber.from(40000000000) // fallback to 40 gwei
    let maxPriorityFeePerGas = ethers.BigNumber.from(40000000000) // fallback to 40 gwei
    const transactionResponse = await contract.setBaseTokenURI(taskArguments.basetoken,{
        maxFeePerGas,
        maxPriorityFeePerGas,
    });
    console.log(transactionResponse);
});


